package com.jsgt.greekfire.ui.trading

//import kotlinx.android.synthetic.main.fragment_trading_1.*
//import kotlinx.android.synthetic.main.fragment_trading_1.trading_rv
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.fhx.core.base.BaseFragment
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.pool.transfercoin.fragment.ChangeIntoFragment
import com.jsgt.greekfire.ui.pool.transfercoin.fragment.TransferOutFragment
import com.jsgt.greekfire.ui.trading.currencytrading.CurrencyTradingFragment
import com.jsgt.greekfire.ui.trading.otc.OTCTradingFragment
import kotlinx.android.synthetic.main.fragment_transaction_page.*

/**
 * 交易
 */
class TradingFragment : BaseFragment() {

    override fun getLayoutId(): Int = R.layout.fragment_transaction_page

    override fun main() {
        val fragmentManager: androidx.fragment.app.FragmentManager = childFragmentManager
        val transaction: FragmentTransaction = fragmentManager.beginTransaction()
        transaction.replace(R.id.fl_fragment_container, CurrencyTradingFragment())
        transaction.commit()

        radio_group.setOnCheckedChangeListener { group, checkedId ->

            val transaction = fragmentManager.beginTransaction()
            //根据RadioButton不同的Id来选中不同的Fragment。
            if (checkedId == R.id.r_btn_currency_trading) {
                transaction.replace(R.id.fl_fragment_container, CurrencyTradingFragment(), "0")
            } else if (checkedId == R.id.r_btn_otc_trading) {
                transaction.replace(R.id.fl_fragment_container, OTCTradingFragment(), "1")
            }
            transaction.commit()
        }
    }

}





